package com.stlm2.dems.entity;

/**
 * Created by apple on 2017/10/20.
 */
public enum CancelReason {
    NotBuy(1) {
        public String toString() {
            return "现在不想购买";
        }
    },
    NoGoods(2) {
        public String toString() {
            return "商品缺货";
        }
    },
    ModifyCart(3) {
        public String toString() {
            return "添加或删除商品";
        }
    },
    AddressError(4) {
        public String toString() {
            return "收货地址信息有误";
        }
    },
    CanNotBuy(5) {
        public String toString() {
            return "订单无法支付";
        }
    },
    OtherReason(6) {
        public String toString() {
            return "其他原因";
        }
    },
    System(7) {
        public String toString() {
            return "系统定时任务";
        }
    },
    Crm(9) {
        public String toString() {
            return "后台操作";
        }
    };
    private final int val;

    CancelReason(int n) {
        val = n;
    }

    public int getIntValue() {
        return val;
    }

    public static CancelReason getByIntValue(int n) {
        switch (n) {
            case 1:
                return NotBuy;
            case 2:
                return NoGoods;
            case 3:
                return ModifyCart;
            case 4:
                return AddressError;
            case 5:
                return CanNotBuy;
            case 6:
                return OtherReason;
            default:
                return null;
        }
    }
}
